﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AtfutureCodeMachine
{
    public partial class FormValidate : Form
    {
        public FormValidate(string val,string yz)
        {
            InitializeComponent();
            string[] arr = yz.Split(',');
            this.clb_yz.Items.Clear();
            foreach (string s in arr)
            {
                this.clb_yz.Items.Add(s);
            }


            for(int i=0;i<this.clb_yz.Items.Count;i++)
            {
                if (("," + val + ",").IndexOf("," + this.clb_yz.Items[i] + ",") != -1)
                {
                    this.clb_yz.SetItemChecked(i, true);
                }
            }
        }

        /// <summary>
        /// 返回值
        /// </summary>
        public string Value = "";

        private void btnSelect_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < this.clb_yz.Items.Count; i++)
            {
                if(this.clb_yz.GetItemChecked(i))
                {
                    Value += "," + this.clb_yz.Items[i];
                }
            }

            if (Value != "") Value = Value.Substring(1);

            this.Close();
        }
    }
}
